var express = require('express');
var index = require('../controllers/admin/index');
var user = require('../controllers/admin/user');
var article = require('../controllers/admin/article');
var category = require('../controllers/admin/category');
var tag = require('../controllers/admin/tag');
var site = require('../controllers/admin/site');

var router = express.Router();

//用户
router.get('/login',user.login);
router.post('/login',user.doLogin);
router.get('/logout',user.logout);
router.get('/register',user.register);
router.post('/register',user.doRegister);

//后台首页
router.get('/', index.index);

//文章
router.get('/article',article.index);
router.get('/article/post',article.post);
router.post('/article/post',article.doPost);
router.get('/article/delete/:id',article.delete);
router.get('/article/update/:id',article.update);
router.post('/article/update',article.doUpdate);


//分类
router.get('/category',category.index);
router.get('/category/add',category.add);
router.post('/category/add',category.doAdd);

//标签
router.get('/tag',tag.index);
router.get('/tag/add',tag.add);
router.post('/tag/add',tag.doAdd);


//网址管理
router.get('/site',site.index);
router.get('/site/add',site.add);
router.post('/site/add',site.doAdd);
router.post('/site/delete/:site_id',site.doAdd);

router.get('/site/type',site.type);
router.get('/site/type/add',site.typeAdd);
router.post('/site/type/add',site.typeDoAdd);

module.exports = router;